<cfif Not IsDefined("session.id")>
		<cflocation url = "/ecada/" addToken = "no">
</cfif>
	
<cfif IsDefined("session.experiment")>
	<!---<cfdump var="#session.experiment#">--->
	<cfset experiment = session.experiment>
<cfelse>
	<cflocation url="/ecada/"  addToken = "no">
</cfif>

	<cfquery datasource="exp" name="conditions">
		SELECT *
		FROM conditions
		WHERE expid = #experiment.id#
		ORDER BY id
	</cfquery>
	
<cfif IsDefined("form.postback")>

	<cfset experiment.Conditions = conditions.recordcount>
	<cfset session.experiment = experiment>
	<cflocation url="./../Step-3"  addToken = "no">

<cfelse>
	<cfinclude template= "/ecada/header.cfm">
	


	<cfoutput>
		<script type="text/javascript">
			$(document).ready(function(){
			//this function is defined in progressbar.cfm and is included in the header
				setProgressText("Specify Condtions");
				setProgress(2);
				});
		</script>
					<h3>Specify your conditions!</h3>
				
					<p>On this page you can specify the conditions of this experiment.</p>
			<table>
			
			<cfloop query="conditions">
				<tr>
					<td>
						#HTMLEditFormat(title)#
					</td>
					<td>
						<form method="post" action="delete/">
							<input type="hidden" value="#HTMLEditFormat(id)#" name="CondID"></input>
							<button class="ui-state-default ui-corner-all" title="Delete Conditions" type="submit" value="Delete Condition">
								<div>
									<!---<div style="float: left; margin-top: 3px; margin-left: 3px;" class="ui-icon ui-icon-arrowturnthick-1-e"></div>--->
									<div style="display: inline-block; margin: 3px;line-height: 16px;"><b>Delete Condition</b></div>
								</div>
							</button>
						</form>
					</td>
					<td>
						<form method="post" action="edit/">
							<input type="hidden" value="#HTMLEditFormat(id)#" name="CondID"></input>
							<button class="ui-state-default ui-corner-all" title="Edit Conditions" type="submit" value="Edit Condition">
								<div>
									<!---<div style="float: left; margin-top: 3px; margin-left: 3px;" class="ui-icon ui-icon-arrowturnthick-1-e"></div>--->
									<div style="display: inline-block; margin: 3px;line-height: 16px;"><b>Edit Condition</b></div>
								</div>
							</button>
						</form>
					</td>
				</tr>
			</cfloop>
			
			<tr>
				<td>
					<form method="post" action="add/">
							<button class="ui-state-default ui-corner-all" title="Add Conditions" type="submit" value="Add Condition">
								<div>
									<!---<div style="float: left; margin-top: 3px; margin-left: 3px;" class="ui-icon ui-icon-arrowturnthick-1-e"></div>--->
									<div style="display: inline-block; margin: 3px;line-height: 16px;"><b>Add Condition</b></div>
								</div>
							</button> 
					</form>
				</td>
			</tr>
		</table>
		<table>
			<tr>
				<td>
					<form method="post" action="./../Step-1">
						<button class="ui-state-default ui-corner-all" title="Back" type="submit" value="Back">
							<div>
								<!---<div style="float: left; margin-top: 3px; margin-left: 3px;" class="ui-icon ui-icon-arrowturnthick-1-e"></div>--->
								<div style="display: inline-block; margin: 3px;line-height: 16px;"><b>Back</b></div>
							</div>
						</button>
					</form>
				</td>
				<td>
					<form method="post" action="./">
						<button class="ui-state-default ui-corner-all" title="Next" type="submit" value="Next" name="postback" id="postback">
							<div>
								<!---<div style="float: left; margin-top: 3px; margin-left: 3px;" class="ui-icon ui-icon-arrowturnthick-1-e"></div>--->
								<div style="display: inline-block; margin: 3px;line-height: 16px;"><b>Next</b></div>
							</div>
						</button>
					</form>

				</td>
			</tr>
		</table>
	</cfoutput>
	
	<cfinclude template= "/ecada/footer.cfm">
</cfif>



